If it's just plain lookup then it's a bit difficult to add dependencies such that when Bean A undeploys, Bean B undeploys too. However, if you had a
@EJB private BeanA a;
in Bean B, then this internally adds a dependency. So if Bean A is redeployed, Bean B is redeployed too.
Apply our latest EJB3 plugin http://www.jboss.org/ejb3/ejb3plugin.html against AS 5.1.0 and see that works. There was a issue which was fixed after 5.1.0 was released and is available in that plugin release https://jira.jboss.org/browse/EJBTHREE-1889